import type { MenuListResult } from '@/api/model/system/permissionModel';
import { request } from '@/utils/request';

const Api = {
  Routers: '/getRouters',
  MenuList: '/system/menu/list',
  AddMenu: '/system/menu',
  InfoMenu: '/system/menu/',
};

// 获取动态路由列表
export function getRouters() {
  return request.get<MenuListResult>({
    url: Api.Routers,
  });
}

// 菜单管理列表
export function getMenuList() {
  return request.get<MenuListResult>({
    url: Api.MenuList,
  });
}

// 添加菜单
export function add(data: any) {
  return request.post({
    url: Api.AddMenu,
    data,
  });
}

// 菜单详情
export function getInfo(id: number | string) {
  return request.get({
    url: Api.InfoMenu + id,
  });
}

// 修改菜单
export function edit(data: any) {
  return request.put({
    url: Api.AddMenu,
    data,
  });
}

// 删除菜单
export function Delete(id: number | string) {
  return request.delete({
    url: Api.InfoMenu + id,
  });
}
